<?php


namespace app\api\controller;


use app\api\exception\UserException;
use app\BaseController;
use app\middleware\Check;
use think\Request;

class Index extends BaseController
{

    public function index(Request $request)
    {
        throw new UserException();
        // echo 1 / 0;
        // echo $this->request->inApp;
        return json(['code' => '301']);
    }

    public function think()
    {
        echo 'hello a ' . __FUNCTION__;
    }

    /**
     * 数组返回值，直接赋值
     */
    public function test_return()
    {
        [$hello, $world] = $this->getUseToken();
        var_dump($hello, $world);
    }

    private function getUseToken()
    {
        return ['hello', 'world'];
    }
}